﻿using LxBasic;

namespace LxCore
{
    public abstract class ParameterBase<T> : FieldBase<T>, IParameter<T>
    {
        public abstract T GetPara();
        public override bool IsParameter(out T value)
        {
            value = GetPara();
            return true;
        }
        public override ICellVarArr<T> GetCellVarArr(IIndexHost indexHost) => new ParaVars<T>(GetPara());
        public override IFaceVarArr<T> GetFaceVarArr(IIndexHost indexHost) => new ParaVars<T>(GetPara());
        public class ParaVars<T2> : ICellVarArr<T2>, IFaceVarArr<T2>
        {
            public ParaVars(T2 para)
            {
                this.Para = para;
            }
            public T2 Para;
            public T2 GetCellVar(int cellID) => Para;
            public T2 GetFaceVar(int faceID) => Para;
        }
    }
}
